package com.cuit.dashboard.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @program: zuke
 * @description: 部门实体类
 * @author: KamTang
 * @create: 2022-06-11 09:17
 **/
@Data
@TableName(value = "sys_department")
public class SysDepartmentEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 部门编号
     */
    @TableId
    private Long id;

    /**
     * 部门名称
     */
    private String name;

    /**
     * 部门电话
     */
    private String phone;

    /**
     * 部门地址
     */
    private String address;

    /**
     * 创建时间
     * 第一次添加时，更新时间默认为添加时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private LocalDateTime modifiedTime;


    /**
     * 逻辑删除
     */
    @TableLogic
    private Integer isDeleted;

    /**
     * 父id
     */
    private Long parentId;

    /**
     * 部门总人数
     */
    @TableField(exist = false)
    private int total;

    @TableField(exist=false)
    private List<SysDepartmentEntity> children;
}
